package com.boot.ip;

import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.awt.print.Book;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @Author: lkz
 * @Title:
 * @Description: 腾讯
 * @Date: 2023/9/6 14:11
 */

public class TenWebserviceHttpAK {


    public static String URL = "https://apis.map.qq.com/ws/location/v1/ip";

    public static String Key = "OTKBZ-UN3W3-XNY3B-O4JVH-EXGHE-RHF5R";// 您的AK

    public static void main(String[] args) throws Exception {



        Map params = new LinkedHashMap<String, String>();
        params.put("ip", "180.111.120.254");
        params.put("key", Key);

        String json = HttpUtil.get(URL, params);
        TenVO locationVO = JSON.parseObject(json, TenVO.class);
        System.out.println(locationVO);
        TenAddInfo tenAddInfo = JSON.parseObject(JSON.toJSONString(locationVO.getResult().get("ad_info")), TenAddInfo.class);
        System.out.println(tenAddInfo);


    }


}


